#include <iostream>
#include <list>
#include <functional>

using std::cout;
using std::endl;
using std::list;
/* using std::less; */

template <typename Container>
void display(const Container &con)
{
    for(auto &elem : con)
    {
        cout << elem << "  ";
    }
    cout << endl;
}

void test()
{
    list<int> number = {1, 3, 5, 5, 9, 9, 8, 6, 2};
    display(number);

    cout << endl << "测试list的sort函数" << endl;
    /* number.sort();//默认情况，会按照从小到大的顺序进行排序 */
    /* std::less<int> les; */
    /* number.sort(std::less<int>()); */
    /* number.sort(les); */
    number.sort(std::greater<int>());
    display(number);
}

int main(int argc, char **argv)
{
    test();
    return 0;
}

